{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<img align=\"left\" src=\"NSIDC_logo_2018_web.jpg\" width=120>\n",
    "\n",
    "\n",
    "# Getting the most out of NSIDC DAAC data: Discovering, Accessing, and Harmonizing Arctic Remote Sensing Data\n",
    "\n",
    "__Authors__: Andy Barrett,  Marin Klinger,  Luis Lopez, Walt Meier, Amy Steiker, Bruce Wallin: NASA National Snow and Ice Data Center Distributed Active Archive Center (NSIDC DAAC)\n",
    "\n",
    "Welcome to the NSIDC DAAC's hands-on tutorial at the 2019 AGU Fall Meeting! \n",
    "\n",
    "#### The learning objectives of this tutorial include:\n",
    "\n",
    "* Become familiar with NSIDC resources, including user support documents, data access options, and data tools and services.\n",
    "* Learn about the coverage, resolution, and structure of sea ice data from the new NASA ICESat-2 mission.\n",
    "* Learn how to access and subset data programmatically using the NSIDC DAAC's API service.\n",
    "* Interact with ICESat-2 and MODIS data using basic Python science libraries to visualize, filter, and plot concurrent data.\n",
    "\n",
    "The tutorial is divided into three main Jupyter Notebooks: __Introduction__, __Customize and Access Data__, and __Visualize and Analyze Data__. Here are the steps you will learn in this Introduction notebook:\n",
    "  \n",
    "1. Learn the basics of Jupyter Lab and Jupyter Notebook\n",
    "2. Get introduced to the Arctic sea ice example data application\n",
    "3. Explore NSIDC data availability and resources, including ICESat-2 and MODIS data\n",
    "4. Visualize time and area of interest using [OpenAltimetry](http://openaltimetry.org/) \n",
    "   \n",
    "\n",
    " Let's get started!\n",
    " \n",
    " \n",
    " ___"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Project Jupyter Overview\n",
    "\n",
    "Before we delve into our Arctic sea ice data exploration, let's go over the basics of how to interact with these Jupyter Notebooks and the Jupyter Lab interface.\n",
    "\n",
    "We will be running the three Jupyter Notebooks comprising this tutorial within the JupyterLab environment. We are working within the NSIDC JupyterHub, powered by Amazon Web Services: https://nsidc-cryohub.org/\n",
    "\n",
    "There is no need to download or install any packages. JupyterHub proxies multiple instances of a single-user JupyterLab server. We have preconfigued the environments and data that you'll be working with during the tutorial.\n",
    "\n",
    "***NSIDC CryoHub will not be accessible after the week of AGU. Please visit the [AGU-2019-NSIDC-Data-Tutorial](https://github.com/nsidc/AGU-2019-NSIDC-Data-Tutorial) Github Repository and follow the README file instructions to install and run these tutorials in a Binder instance or on your local machine.***\n",
    "\n",
    "For more information on these Project Jupyter components, please visit the following references: \n",
    "\n",
    "### [Jupyter Notebook](https://jupyter-notebook.readthedocs.io/en/stable/) \n",
    "\n",
    "Interactive, reproducible, open source, and exploratory browser integrated computing environment.\n",
    "\n",
    "    \n",
    "### [JupyterLab](https://jupyterlab.readthedocs.io/en/stable/)\n",
    "\n",
    "Web-based integrated IDE for computational workflows.\n",
    "\n",
    "  \n",
    "### [JupyterHub](https://jupyterhub.readthedocs.io/en/stable/)\n",
    "\n",
    "Multi-user access to Jupyter Notebooks. Deploy to users within an organization on centralized infrastructure using on-premise or cloud resources.\n",
    "\n",
    "___"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Jupyter Notebook Basics\n",
    "The body of a notebook is composed of cells. Each cell contains either markdown, code input, code output, or raw text. Cells can be included in any order and edited and executed at-will.\n",
    "\n",
    "- **Markdown cells** - These are used to build a nicely formatted narrative around the code in the document. \n",
    "\n",
    "- **Code cells** - These are used to define the computational code in the document. They come in two forms: the *input cell* where the user types the code to be executed, and the *output cell* which is the representation of the executed code. \n",
    "\n",
    "- **Raw cells** - These are used when text needs to be included in raw form, without execution or transformation.\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Execute a cell or selected cells by pressing shift + enter"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "print('Hello World!')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Collapse a cell or cell output by clicking on the blue line to the left of the cell \n",
    "\n",
    "The cell content is replaced by three dots, indicating that the cell is collapsed.\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Execute multiple cells or run the entire notebook \n",
    "\n",
    " * Select cells with **shift + Up or shift + Down** and then execute selection with **shift + enter.**\n",
    " \n",
    " * Run the whole notebook in a single step by clicking on the menu **Run -> Run All Cells.**\n",
    " "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "____\n",
    "### Example Application: Using ICESat-2 sea ice height and MODIS ice surface temperature (IST) data to investigate the boundary between shore fast ice and drift ice in the East Siberian Sea.    \n",
    "\n",
    "#### Some context...\n",
    " * **Fast ice**: *ice that is anchored (fastened) to the shore or ocean bottom, typically over shallow ocean shelves at continental margins; fast ice is defined by the fact that it does not move with the winds or currents.*\n",
    " \n",
    "     * **Characteristics**:\n",
    "      * Attached to shoreline or pinned to ocean bottom\n",
    "      * Lower surface roughness compared to drift ice\n",
    "      * Graduated thickness from new ice to thicker 1st year ice \n",
    "      * Leads typically separate fast ice from drift ice     "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "___\n",
    "## Overview of NSIDC data and resources\n",
    "\n",
    "[The National Snow and Ice Data Center](https://nsidc.org) provides over 1100 data sets covering the Earth's cryosphere and more, all of which are available to the public free of charge. Beyond providing these data, NSIDC creates tools for data access, supports data users, performs scientific research, and educates the public about the cryosphere. \n",
    "\n",
    "### Data Resources\n",
    "\n",
    "* [NSIDC Data Search](https://nsidc.org/data/search)\n",
    "    * Search all NSIDC Data\n",
    "* [NSIDC Data Update Announcements](https://nsidc.org/the-drift/data-update/) \n",
    "    * News and tips for data users\n",
    "* [NASA Earthdata Search](http://search.earthdata.nasa.gov/)\n",
    "    * Search and access data across the NASA Earthdata\n",
    "    \n",
    "We'll explore data access and support resources in more detail below with our ICESat-2 and MODIS data sets of interest.\n",
    "\n",
    "___"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    " ## NASA's ICESat-2 mission\n",
    "\n",
    "<img align=\"right\" src=\"https://nsidc.org/sites/nsidc.org/files/images/atlas-beam-pattern.png\" width=600>\n",
    "\n",
    "The Ice, Cloud, and Land Elevation Satellite-2 (ICESat-2) carries the Advanced Topographic Laser Altimeter System (ATLAS), a photon-counting laser altimeter, that measures the height of Earth's changing polar regions. The ATLAS instrument releases 10,000 laser pulses per second, split into 3 weak/strong beam pairs at a wavelength of 532 nanaometers (bright green on the visible spectrum). Measurements are taken every 70 cm along the satellite's ground track with a footprint diameter of 17 m. The beam pairs are spaced 3.3 km apart, with a distance of 90 m between each weak and strong beam. ICESat-2 orbits Earth every 91 days to allow for height change detection in all four seasons. In addition to land ice and sea ice, ICESat-2 also measures the height of vegetation, land surface, water, and clouds. See the [NASA ICESat-2 home page](https://icesat-2.gsfc.nasa.gov/) for more information. \n",
    " \n",
    "\n",
    "\n",
    "  ### Data references \n",
    "  \n",
    " [The NSIDC ICESat-2 home page](https://nsidc.org/data/icesat-2) provides an overview of the data products and user resources available. \n",
    " \n",
    " * Associated access, visualization, and data customization tools and services are provided on the [ICESat-2 Tools page](https://nsidc.org/data/icesat-2/tools).\n",
    "     * [ICESat-2 Hackweek tutorials](https://github.com/ICESAT-2HackWeek/ICESat2_hackweek_tutorials)\n",
    "     * [icepyx](https://github.com/icesat2py/icepyx): A collection of python tools for obtaining and working with ICESat-2 data.\n",
    " \n",
    " \n",
    " \n",
    "Each data set has an associated landing page with citation information, a curated user guide, support documentation, and the ability to access data by time, spatial region, and granule name:\n",
    "\n",
    "\n",
    "* [ATL03](https://nsidc.org/data/atl03): Global Geolocated Photon Data\n",
    "     * ATL03 provides time, latitude, longitude, and ellipsoidal height for each photon event downlinked from ATLAS. Heights are corrected for several geophysical phenomena, such as effects of the atmosphere and solid earth deformation. \n",
    "     * Resolution: 70 cm\n",
    "     * Format: HDF5; most variables are provided as 1-D arrays\n",
    "     * [ATL03 Data Dictionary](https://nsidc.org/sites/nsidc.org/files/technical-references/ATL03-data-dictionary-v001.pdf)\n",
    "     \n",
    "     \n",
    "* [ATL07](https://nsidc.org/data/atl07): Level 3A Sea Ice Height\n",
    "     * ATL07 provides along-track surface height and type (e.g., snow-covered ice, open water) for the ice-covered seas of the northern and southern hemispheres when the surface is visible (relatively cloud free) and the ice concentration is >15%. Sea surface and sea ice height are estimated for segments along each of the six ground tracks. \n",
    "      * Resolution:  Each height value corresponds to a variable along-track length made up of 150 photons.\n",
    "      * Format: HDF5; most variables are provided as 1-D arrays\n",
    "      * [ATL07 Data Dictionary](https://nsidc.org/sites/nsidc.org/files/technical-references/ATL07-data-dictionary-v001.pdf)\n",
    "      \n",
    "      \n",
    "* [ATL10](https://nsidc.org/data/atl10): Level 3A Sea Ice Freeboard\n",
    "    * ATL10 provides estimates of along-track, total freeboard for the ice-covered seas of the northern and southern hemispheres along segments generated in the ATL07 product, providing data when the ice concentration is >50% and 25 km away from the coast.\n",
    "    * Resolution: Each height value corresponds to a variable along-track length made up of 150 photons.\n",
    "    * Format: HDF5; most variables are provided as 1-D arrays\n",
    "    * [ATL10 Data Dictionary](https://nsidc.org/sites/nsidc.org/files/technical-references/ATL10%20Product%20Data%20Dictionary.pdf)\n",
    "    \n",
    "  "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Using OpenAltimetry to explore ICESat-2 coverage  \n",
    "\n",
    "We'll use the [OpenAltimetry](https://openaltimetry.org/data/icesat2/?annoId=119&shareKey=31a6dd4555dc1b8ccbd84fce02a63d37) application to easily visualize the coverage over our area of interest, including an overlay of MODIS reflectance imagery to observe cloud cover. The link provides a previously created data annotation that automatically zooms into our study area. These annotations can be created and shared by all users of OpenAltimetry. \n",
    "\n",
    "Note the following characteristics of the ATLAS instrument and the ATL07 and ATL10 products in particular:\n",
    "\n",
    "1. Three weak/strong beam pairs\n",
    "    * Over our day of interest, the `gt*l` groups designate the strong beams, wherase the `gt*r` groups designate the weak beams.\n",
    "2. Variable segment lengths dependent on the distance over which approximately 150 signal photons are accumulated. \n",
    "3. Over thin ice, we see less data coverage in the ATL10 product compared to ATL07, with lower quality and higher noise. \n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "___\n",
    "## MODIS Ice Surface Temperature \n",
    "\n",
    "Moderate-resolution Imaging Spectroradiometer (MODIS) ice surface temperature (IST) data are available in Level-2 swaths and Level-3 grids. For this tutorial we will be using the Level 2 swath data. MODIS data are available at 1 km resolution. IST retrievals occur for cloud free Arctic and Antarctic sea ice, for day and night. \n",
    "\n",
    "IST is the radiating temperature at the ice surface. The IST algorithm for MODIS uses a split-window technique. MODIS bands 31 and 32 (brightness temperature) provide the ability for IST detection. \n",
    "\n",
    "### Data references\n",
    "\n",
    "[The NSIDC MODIS home page](https://nsidc.org/data/modis/) provides an overview of the data products and user resources available.\n",
    "\n",
    "* Associated access, visualization, and data customization tools and services are provided on the [MODIS Tools page](https://nsidc.org/data/modis/tools.html).\n",
    "\n",
    "Each data set has an associated landing page with citation information, a curated user guide, support documentation, and the ability to access data by time, spatial region, and granule name:\n",
    "\n",
    "* [MOD29](https://nsidc.org/data/mod29)/[MYD29](https://nsidc.org/data/myd29): Level 2 sea ice surface temperature\n",
    "  * Resolution: 1 km \n",
    "  * Format: swath, HDF-EOS2\n",
    "        "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### MODIS IST over our study area\n",
    "\n",
    "We are looking for a clear day across the coast, fast ice, and on to drift ice: March 23, 2019 over the East Siberian Sea provides those ideal conditions. Below is imagery from [NASA Worldview](https://go.nasa.gov/34fBnp8) overlain with MODIS Terra IST over this region:\n",
    "\n",
    "![MODIS](https://wvs.earthdata.nasa.gov/api/v1/snapshot?REQUEST=GetSnapshot&TIME=2019-03-23T00:00:00Z&BBOX=-1095566.2289737656,918471.1511079771,593009.7710262344,2165703.151107977&CRS=EPSG:3413&LAYERS=MODIS_Terra_CorrectedReflectance_TrueColor,Coastlines,MODIS_Terra_Ice_Surface_Temp_Day&WRAP=day,x,day&FORMAT=image/png&WIDTH=3298&HEIGHT=2436&ts=1574699150030)\n",
    "NASA worldview imagery overlain with MODIS Terra IST over East Siberian Sea, March 23, 2019. Lighter green colors correspond to warmer temperatures, while darker blue colors represent colder temperatures, with land and cloud cover in gray. Image credit: NASA Worldview\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### We are now ready to explore NSIDC's data holdings and access data in the `Customize and Access Data` notebook."
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
